package dashboard

import (
	"encoding/json"
	"gitee.com/yangguoliang001/go-gin-vue3/pkg/response"
	"github.com/gin-gonic/gin"
)

// QueryDashboardInfo 获取仪表盘数据
// @Summary 获取仪表盘数据
// @Description 获取仪表盘数据
// @Tags API.dashboard
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {object} response.TResponse{data=vo.DashboardVo}
// @Failure 400 {object} response.TResponse{data=interface{}}
// @Router /api/dashboard [get]
func (d *dashboardController) QueryDashboardInfo(c *gin.Context) {
	systemInfo, err := d.dashboardService.QuerySystemInfo(c)
	if err != nil {
		return
	}
	j, _ := json.Marshal(systemInfo)
	dashboardMap := make(map[string]interface{})
	_ = json.Unmarshal(j, &dashboardMap)

	response.Success(c, "获取仪表盘数据成功", dashboardMap)
}
